package oop;

public class Extens {
    public static void main(String[] args) {
        Penguin p = new Penguin("xiaozhu",1);
        Animal a1 = new Animal("xiaozhi",2);
        Animal a = p;
//        ((Penguin) a).stand();
        Animal a2 = new Penguin("xiaozhu",1);
        a.eat();
        a2.eat();
        B b = new A();
        b.test();
        Penguin p1 = (Penguin)a;
        p1.stand();
    }
}

class Animal {
    private String name;
    private int id;
    public Animal(String myName, int myid) {
        name = myName;
        id = myid;
    }
    public void eat(){
        System.out.println(name+"正在吃");
    }
    public void sleep(){
        System.out.println(name+"正在睡");
    }
    public void introduction() {
        System.out.println("大家好！我是"         + id + "号" + name + ".");
    }
}

class Penguin extends Animal {
    public Penguin(String myName, int myid) {
        super(myName, myid);
    }
    public void eat(){
        System.out.println("1112321"+"正在吃");
    }
    public void stand(){
        System.out.println("我站着");
    }
}